﻿@using XStudio.XCRF.Data.Entities
@model LabCheckStd
@{
    ViewBag.Title = "实验室标准添加";
    Layout = "~/Views/Shared/Master.cshtml";
}
@{Html.Telerik().Window().Name("LabCheckStdAddWindouw").Title("实验室标准添加").HtmlAttributes(new { @class = "ContentLargeWindow" })
    .Buttons(buttons => buttons.Clear())
    .Content(
@<text>
@{using (Ajax.BeginForm<LabCheckStdController>(c => c._LabCheckStdAdd(null),
   new AjaxOptions { OnBegin = "BeforeSend", OnSuccess = "OnSuccess", OnFailure = "OnError" }))
  {
    @Html.HiddenFor(model => model.HospitalID)
    @Html.HiddenFor(model => model.Gender)
    @panelBar()<br />
    <input type="submit" value="提交" />
  }
  }
</text>
).Render();
}
@helper panelBar()
    {
    Html.Telerik().PanelBar()
    .Name("LabCheckMenu")
    .HtmlAttributes(new { @class = "ContentWindow" })
    .Items(items =>
    {
        items.Add().Text("血沉")
            .Content(@<text>
              @Html.Partial("ESRStdEdit", Model)
              </text>);
        items.Add().Text("血常规")
            .Content(@<text>
              @Html.Partial("BloodStdEdit", Model)
              </text>);
        items.Add().Text("尿常规")
            .Content(@<text>
              @Html.Partial("UrineStdEdit", Model)
              </text>);
        items.Add().Text("粪常规")
            .Content(@<text>
              @Html.Partial("FaecesStdEdit", Model)
              </text>);
        items.Add().Text("肝肾功能")
            .Content(@<text>
              @Html.Partial("LiverKidneyStdEdit", Model)
              </text>);
        items.Add().Text("肿瘤标志物")
            .Content(@<text>
              @Html.Partial("TumorStdEdit", Model)
              </text>);
        items.Add().Text("免疫系统相关")
            .Content(@<text>
              @Html.Partial("ImuneStdEdit", Model)
              </text>);
    }).Render();
}
@{Html.Telerik().Window().Modal(true).Visible(false)
    .Name("adding").Title("系统提示")
    .Buttons(buttons => buttons.Clear())
    .ClientEvents(window => window.OnOpen("OnAddingOpen"))
    .Content(
@<text>
正在添加，请稍后...
</text>)
    .Render();
}
@{Html.Telerik().Window().Modal(true).Visible(false)
    .Name("addError").Title("系统提示")
    .Buttons(buttons => buttons.Close())
    .ClientEvents(window => window.OnOpen("OnAddErrorOpen"))
    .Content(
@<text>
出现错误，请重试！
</text>)
    .Render();
}
<script type="text/javascript">
    function OnAddingOpen() {
        $("#adding").data("tWindow").center();
    }
    function OnAddErrorOpen() {
        $("#addError").data("tWindow").center();
    }
    function BeforeSend() {
        $("#adding").data("tWindow").open();
    }
    function OnSuccess(data) {
        if (data.ID) {
            var url = "@(Url.Action<LabCheckStdController>(c => c.LabCheckStdDetail(Guid.Empty)))";
            url = url.replace("@Guid.Empty", data.ID);
            window.location = url;
        } else {
            alert("error");
        }
    }
    function OnError() {
        $("#addError").data("tWindow").open();
        $("#adding").data("tWindow").close();
    }
    function CheckForm() {
        alert("请输入您姓名!");
        if (document.form.Name.value.length == 0) {
            alert("请输入您姓名!");
            document.form.Name.focus();
            return false;
        }
        return true;
    }
</script>